'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
var setTransition = exports.setTransition = function setTransition(_ref) {
    var dom = _ref.dom,
        start = _ref.start,
        end = _ref.end,
        _ref$className = _ref.className,
        className = _ref$className === undefined ? '' : _ref$className;

    className && dom.classList.add(className);

    var cancel = function cancel() {
        dom.removeEventListener('transitionend', _end);
    };
    var _end = function _end() {
        cancel();
        className && dom.classList.remove(className);
        end && end();
    };
    dom.addEventListener('transitionend', _end);
    start && start(dom);

    return {
        cancel: cancel,
        end: _end
    };
};
exports.default = setTransition;